﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessEntity;
using Webcar.BLL;
using ToolsLayer;

namespace Webcar.Car
{
    public partial class CarSendPrint : System.Web.UI.Page
    {
        protected string m_sendno
        {
            get { return Page.Request.QueryString["sendno"]; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack) return; 
            if (m_sendno == "") return;
            CarBLL cb = new CarBLL();
            BS_CAR_SENDEntity sendinfo = cb.GetCarSendInfo(this.m_sendno);
            DEPTEntity dept = new DEPTEntity();
            dept.DEPT_CODE = sendinfo.DEPT_CODE;
            dept.Retrieve();
            this.lblDept.Text = dept.DEPT_NAME;
            string child_dept_name = DB.ExecuteScalar("select dept_name from dept_child where child_dept='"+sendinfo.Dept2+"'");

            this.lblDept2.Text = string.IsNullOrEmpty(child_dept_name) ? sendinfo.Dept2 : child_dept_name;
            this.lblJhr.Text = sendinfo.JHR;
            try
            {
                this.lblRecord.Text = cb.GetCar(sendinfo.CarNo).RECORD_NO;
            }
            catch
            {
                this.lblRecord.Text = "无车辆";           
            }
            this.lblSqr.Text = sendinfo.SQR;
            this.lblNums.Text = sendinfo.USE_NUMS.ToString();
            this.lbldriver.Text = sendinfo.DriverName;
            this.lblcheckman.Text = sendinfo.CHECK_MAN;
            this.lblstartdate.Text = sendinfo.START_DATE.ToString("yyyy-MM-dd");
            this.lblJobKind.Text = DB.ExecuteScalar("select base_name from  v_job_kind where base_code='"+sendinfo.JOB_KIND+"'");
            this.lblSendMan.Text = sendinfo.SEND_MAN;
            this.lblReturnDate.Text = sendinfo.END_DATE.ToString("yyyy-MM-dd");
            this.lblWZ.Text = sendinfo.material;
            this.lblwznums.Text = sendinfo.material_nums.ToString();
            this.lblPlace.Text = sendinfo.PLACE;
            this.lblCause.Text = sendinfo.REASON;
            this.lblSec.Text = sendinfo.sec_cause;
            this.lblRemark.Text = sendinfo.REMARK;
            this.lblsqdate.Text = "申请时间：" + sendinfo.sqdate.ToString("yyyy-MM-dd HH:mm");
            this.lblcheckdate.Text = "审核时间：" + sendinfo.CHECK_DATE.ToString("yyyy-MM-dd HH:mm");

            this.lblHeader.Text = this.lblDept.Text +"派车单";

        }
    }
}
